﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FieldOfViewComponent : MonoBehaviour
{
    [SerializeField]
    Camera mainCamera;

    [SerializeField]
    UIInput inputView;

    [SerializeField]
    UIScrollBar scrollBarView;
    void Start()
    {

    }

    public void UpdateCameraView()
    {
        inputView.value = mainCamera.fieldOfView.ToString();
    }

    public void RevertView()
    {
        mainCamera.fieldOfView = 60;
        inputView.value = 60.ToString();
        scrollBarView.value = 0.5f;
    }

    public void ChangeView()
    {
        float value;
        if (float.TryParse(inputView.value, out value))
        {
            mainCamera.fieldOfView = value;
            scrollBarView.value = (mainCamera.fieldOfView - 1) /100f;
        }
    }


}
